package com.xunwulian.base.constant;

import com.xunwulian.base.util.EnumType;

import java.util.ArrayList;
import java.util.List;

public enum SmsType implements EnumType<SmsType, Integer, String> {

    SEND(1, "发送"),
    RECEIVE(2, "接收");

    public int type;
    public String desc;

    SmsType(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    private static List<Integer> legalList = new ArrayList<Integer>();

    static {
        legalList.add(SEND.type);
        legalList.add(RECEIVE.type);
    }

    public static boolean isLegal(String type) {
        if (type == null) {
            return false;
        }
        return legalList.contains(Integer.valueOf(type));
    }

    @Override
    public Integer getType() {
        return this.type;
    }

    @Override
    public String getDesc() {
        return this.desc;
    }
}
